<?php
defined('BASEPATH') OR exit('No direct script access allowed');

?>

       
                    <div class="row">
                    
                    <div class="col-md-12">
                             <div class="box">
                                <div class="box-header with-border">
                                    <h3 class="box-title">编辑权限 (<?php echo $user_info[0]->last_name.' '.$user_info[0]->email
                                    ;?>)</h3>
                                </div>
                                <div class="box-body">
                                
                                    <?php echo $messages;?>
                                    <?php echo form_open(current_url(), array('class' => 'form-horizontal', 'id' => 'form-edit')); ?>
                 

<table class="table table-striped table-hover">
    <thead>
        <tr>
            <th>权限</th>
            <th>允许</th>
            <th>禁止</th>
            <th>从用户组继承</th>
        </tr>
    </thead>
    <tbody>
    <?php if($permissions) : ?>
        <?php foreach($permissions as $k => $v) : ?>
        <tr>
            <td><?php echo $v['name']; ?></td>
            <td><?php echo form_radio("perm_{$v['id']}", '1', set_radio("perm_{$v['id']}", '1', $this->ion_auth_acl->is_allowed($v['key'], $users_permissions))); ?></td>
            <td><?php echo form_radio("perm_{$v['id']}", '0', set_radio("perm_{$v['id']}", '0', $this->ion_auth_acl->is_denied($v['key'], $users_permissions))) ?></td>
            <td><?php echo form_radio("perm_{$v['id']}", 'X', set_radio("perm_{$v['id']}", 'X', ( $this->ion_auth_acl->is_inherited($v['key'], $users_permissions) || ! array_key_exists($v['key'], $users_permissions)) ? TRUE : FALSE)); ?> (继承 <?php echo ($this->ion_auth_acl->is_inherited($v['key'], $group_permissions, 'value')) ? "允许" : "禁止"; ?>)</td>
        </tr>
        <?php endforeach; ?>
    <?php else: ?>
        <tr>
            <td colspan="4">请先增加权限</td>
        </tr>
    <?php endif; ?>
    </tbody>
</table>

<div class="form-group">
                                            <div class="col-sm-offset-0 col-sm-12">
                                                <div class="btn-group">
                                                    <?php echo form_button(array('type' => 'submit','class' => 'btn btn-primary btn-flat', 'content' => lang('actions_submit'))); ?>
                                                    <?php echo form_button(array('type' => 'reset', 'class' => 'btn btn-warning btn-flat', 'content' => lang('actions_reset'))); ?>
                                                    <?php echo anchor('admin/users', lang('actions_cancel'), array('class' => 'btn btn-default btn-flat')); ?>
                                                </div>
                                            </div>
                                        </div>

<?php echo form_close(); ?>

</div></div>


                    </div>
               